<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div class="navbar navbar-default navbar-fixed-top">
    <div class="container">
        <div class="active navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="${config.getPath()}">${config.getSiteName()}</a>
        </div>
        <div class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Characters<b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="${req.contextPath}?action=create&amp;resource=character">Create Character</a></li>
                        <li><a href="${req.contextPath}?action=list&amp;resource=character">List Characters</a></li>
                    </ul>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dialogs<b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="${req.contextPath}?action=create&amp;resource=dialog">Create Dialog</a></li>
                        <li><a href="${req.contextPath}?action=list&amp;resource=dialog">List Dialog</a></li>
                    </ul>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Locations<b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="${req.contextPath}?action=create&amp;resource=location">Create Location</a></li>
                        <li><a href="${req.contextPath}?action=list&amp;resource=location">List Location</a></li>
                    </ul>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Plots<b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="${req.contextPath}?action=create&amp;resource=plot">Create Plot</a></li>
                        <li><a href="${req.contextPath}?action=list&amp;resource=plot">List Plots</a></li>
                    </ul>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Tasks<b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="${req.contextPath}?action=create&amp;resource=task&amp;for=character">Create Character Task</a></li>
                        <li><a href="${req.contextPath}?action=create&amp;resource=task&amp;for=dialog">Create Dialog Task</a></li>
                        <li><a href="${req.contextPath}?action=create&amp;resource=task&amp;for=location">Create Location Task</a></li>
                        <li><a href="${req.contextPath}?action=create&amp;resource=task&amp;for=plot">Create Plot Task</a></li>
                        <li class="divider"></li>
                        <li><a href="${req.contextPath}?action=list&amp;resource=task">List My Pending Tasks</a></li>
                        <li><a href="${req.contextPath}?action=list&amp;resource=task&amp;and=list-assigned">List Tasks I Assigned</a></li>
                    </ul>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Notifications<b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="${req.contextPath}?action=create&amp;resource=notificationtemplate">Create Notification Template</a></li>
                        <li><a href="${req.contextPath}?action=list&amp;resource=notificationtemplate">List My Notification Template</a></li>
                        <li class="divider"></li>
                        <li class="dropdown-header">Notifications</li>
                        <li><a href="${req.contextPath}?action=list&amp;resource=notification">List My Notifications</a></li>
                    </ul>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Category<b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="${req.contextPath}?action=create&amp;resource=category">Create Category</a></li>
                        <li><a href="${req.contextPath}?action=list&amp;resource=category">List Categories</a></li>
                    </ul>
                </li>
            </ul>
            <div class="nav navbar-nav navbar-right">
                <!-- replace with login box or account box-->
                <c:choose >
                    <c:when test="${loggedIn == 1}">
                        <ul class="nav navbar-nav">
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Welcome ${user.name}<b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    <c:if test="${user.roleId == 2}">
                                        <%-- temporary solution for providing access to create acl for admin roles--%>
                                        <li><a href="${req.contextPath}?action=create&amp;resource=accesscontrollist">Create access control rules.</a></li>
                                        </c:if>
                                    <li><a href="${req.contextPath}?action=list&amp;resource=userhistory&amp;uid=${user.id}">View Your Recent History</a></li>
                                    <li><a href="${req.contextPath}?action=list&amp;resource=userhistory">View Everyone's Recent History</a></li>
                                    <li><a href="${req.contextPath}?action=logout&amp;resource=site">Logout</a></li>
                                </ul>
                            </li>
                        </ul>
                    </c:when>
                    <c:otherwise>
                        <form class="navbar-form navbar-left csd_login_box" method="post" action="${config.getPath()}">
                            <input name="username" id="username" class="form-control" placeholder="Username" required="" autofocus="" type="text">
                            <input name="password" id="password" class="form-control" placeholder="Password" required="" type="password">
                            <button class="btn btn-primary" type="submit" name="formSubmit" id="formSubmit" value="login-site">Login</button>
                        </form>
                    </c:otherwise>
                </c:choose>
            </div>

        </div><!--/.nav-collapse -->
    </div>
</div>
